//
//  IdentifyAndMaintainDetailVCViewController.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/8/4.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "IdentifyAndMaintainDetailVC.h"
#import "UserInfoModel.h"
#import "IdOrMteDetailModel.h"
#import "IdentifyResultsCell.h"
#import "GoodsSectionCell.h"
#import "OrderAddressCell.h"
#import "OrderDetailNotifierCell.h"
#import "OrderGoodsImgCell.h"
#import "OrderGoodsInfoCell.h"
#import "OrderGoodsServiceCell.h"
#import "OrderInfoCell.h"
#import "LGImageManagerIO.h"
#import "OrderLogisticsViewController.h"
#import "MyAddressListViewController.h"
#import "OrderNewAddressCell.h"
#import "RefoundDetailViewController.h"
#import "LGCommentViewController.h"
#import "LGRefundApplyVC.h"
#import "AddSendInfoViewController.h"
#import "CustomerServiceViewController.h"


NSString *const  IdentifyAndMaintainDetailAddressCellIdentifier = @"IdentifyAndMaintainDetailAddressCellIdentifier";
NSString *const  IdentifyAndMaintainDetailNotifierCellIdentifier = @"IdentifyAndMaintainDetailNotifierCellIdentifier";
NSString *const  IdentifyAndMaintainDetailGoodsImgCellIdentifier = @"IdentifyAndMaintainDetailGoodsImgCellIdentifier";
NSString *const  IdentifyAndMaintainDetailGoodsInfoCellIdentifier = @"IdentifyAndMaintainDetailGoodsInfoCellIdentifier";
NSString *const  IdentifyAndMaintainDetailGoodsServiceCellIdentifier = @"IdentifyAndMaintainDetailGoodsServiceCellIdentifier";
NSString *const  IdentifyAndMaintainDetailInfoCellIdentifier = @"IdentifyAndMaintainDetailInfoCellIdentifier";
NSString *const  IdentifyAndMaintainDetailNewAddressCellIdentifier = @"IdentifyAndMaintainDetailNewAddressCellIdentifier";
NSString *const  IdentifyAndMaintainDetailIdentifyResultsCellIdentifier = @"IdentifyAndMaintainDetailIdentifyResultsCellIdentifier";
NSString *const  IdentifyAndMaintainDetailGoodsSectionCellIdentifier = @"IdentifyAndMaintainDetailGoodsSectionCellIdentifier";

@interface IdentifyAndMaintainDetailVC ()
@property(nonatomic, assign) IdentifyAndMaintainDetailState state;
@property(nonatomic, assign) IdentifyAndMaintainDetailType type;
@property(nonatomic, copy) NSString * orderId;
@property(nonatomic, strong)  IdOrMteDetailModel  *detailModel;
@end

@implementation IdentifyAndMaintainDetailVC
- (instancetype)initWithStyle:(IdentifyAndMaintainDetailState) state  withVCType:(IdentifyAndMaintainDetailType) type withOrderId:(NSString *)order_id{
    
    self = [super init];
    if (self) {
        self.state = state;
        self.type = type;
        self.orderId = order_id;
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    NSString * titleStr = [self getTitleWithStyle:self.state];
    [self setNavigationItemTitle: titleStr];
    [self requestOrderDetail];
    
    if (self.state == IdentifyAndMaintainDetailState_waitComment||self.state == IdentifyAndMaintainDetailState_waitPayment|| self.state == IdentifyAndMaintainDetailState_waitGoods ||self.state == IdentifyAndMaintainDetailState_waitSend ) {
        [self setupBottomView];
    }
    
    if (self.state !=  IdentifyAndMaintainDetailState_cancel ||self.state != IdentifyAndMaintainDetailState_completeRefund ) {
        [self setupRightItem];
        
    }
}
- (void)setupBottomView{
    CGFloat bottomHeight = 50;
    UIView * bottomView = [[UIView alloc]initWithFrame:CGRectMake(0,  self.view.frame.size.height-bottomHeight, self.view.frame.size.width, bottomHeight)];
    [bottomView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:bottomView];
    NSString * btnTitle = @"立即支付";
    if (self.state == IdentifyAndMaintainDetailState_waitPayment ){
        btnTitle = @"立即支付";
    }else if (self.state == IdentifyAndMaintainDetailState_waitComment){
        btnTitle = @"立即评价";
    }else if ( self.state == IdentifyAndMaintainDetailState_waitGoods ){
        btnTitle = @"确认收货";
        
    }else if(self.state == IdentifyAndMaintainDetailState_waitSend){
         btnTitle = @"填写寄件物流";
    }
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:btnTitle forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [btn addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside];
    [btn setFrame:CGRectMake(20, 5, self.view.frame.size.width -40, bottomHeight- 10)];
    btn.layer.cornerRadius = (bottomHeight- 10)/2;
    btn.layer.masksToBounds =  YES;
    btn.titleLabel.font = [UIFont systemFontOfSize:14];
    [bottomView addSubview:btn];
    UIImage * bgImg = [LGImageManagerIO createGradualColorImage:btn.size startColor:UIColorFromRGB(0xE1CFA9) endColor:UIColorFromRGB(0xC1B284)];
    [btn setBackgroundImage:bgImg forState:UIControlStateNormal];
}

- (void)btAction:(id)sender{
    if ( self.state == IdentifyAndMaintainDetailState_waitGoods ){
        [self showAlertView:@"确定已经收到货了吗?" withConfirmAction:^(UIAlertAction *action) {
            [self requestCancelOrder:@"40"];
        } withCancelAction:^(UIAlertAction *action) {
            
        }];
    }else if (self.state == IdentifyAndMaintainDetailState_waitComment){
        
        [self gotoCommentVC];
    }else if (self.state == IdentifyAndMaintainDetailState_waitPayment){
        //支付
        
    }else if(self.state == IdentifyAndMaintainDetailState_waitSend){
        //填写寄件物流
        [self  gotoAddExpressVC];
    }
    
}

- (void)setupRightItem{
    
    NSString * barTitle = @"";
    if (self.state == IdentifyAndMaintainDetailState_waitPayment  ) {
        barTitle  =@"取消订单";
    }else if (self.state == IdentifyAndMaintainDetailState_waitSend||self.state == IdentifyAndMaintainDetailState_waitGoods||self.state ==IdentifyAndMaintainDetailState_waitComment||self.state == IdentifyAndMaintainDetailState_complete){
        barTitle = @"申请退款";
    }else if (self.state == IdentifyAndMaintainDetailState_refundReview){
        barTitle = @"取消退款";
    }
    UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightBtn setTitle:barTitle forState:UIControlStateNormal];
    [rightBtn setTitleColor:UIColorFromRGB(0x333333) forState:UIControlStateNormal];
    [rightBtn addTarget:self action:@selector(rightAction:) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem * rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
    self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)rightAction:(id)sender{
    if (self.state == IdentifyAndMaintainDetailState_waitPayment  ) {
        //        barTitle  =@"取消订单";
        [self showAlertView:@"确定取消该订单吗?" withConfirmAction:^(UIAlertAction *action) {
            [self requestCancelOrder:@"90"];
        } withCancelAction:^(UIAlertAction *action) {
            
        }];
    }else if (self.state == IdentifyAndMaintainDetailState_waitSend||self.state == IdentifyAndMaintainDetailState_waitGoods||self.state == IdentifyAndMaintainDetailState_waitComment||self.state == IdentifyAndMaintainDetailState_complete){
        //        barTitle = @"申请退款";
        [self gotoRefundApplyVC];
    }else if (self.state == IdentifyAndMaintainDetailState_refundReview){
        //        barTitle = @"取消退款";
        
        [self showAlertView:@"确定取消该退款吗?" withConfirmAction:^(UIAlertAction *action) {
            [self requestCancelRefund];
        } withCancelAction:^(UIAlertAction *action) {
            
        }];
    }
    
}

//取消退款
- (void)requestCancelRefund{
    if (!self.detailModel.data.refund_id) {
        return ;
    }
    NSDictionary * params = @{@"refund_id":self.detailModel.data.refund_id,@"token":UserInfo.userToken};
    
    [[MainApi sharedInstance] postPath:@"/Otherorder/cancelRefund" params:params resultBlock:^(NSDictionary *responseObject, NSError *error) {
        
        NSLog(@"%@===",responseObject);
        if (!error) {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"UPDATE_IdAndMaOrder_LIST" object:nil];
            [self backViewController];
        }
        
        
    }];
}
//取消订单
- (void)requestCancelOrder:(NSString *)status{
    NSDictionary * params = @{@"order_id":self.orderId,@"token":UserInfo.userToken,@"status":status};
    
    [[MainApi sharedInstance] postPath:@"/Otherorder/confirmOrCancel" params:params resultBlock:^(NSDictionary *responseObject, NSError *error) {
        
        NSLog(@"%@===",responseObject);
        if (!error) {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"UPDATE_IdAndMaOrder_LIST" object:nil];
            [self backViewController];
        }
        
        
    }];
}
- (void)showAlertView:(NSString *)msg withConfirmAction:(void (^ __nullable)(UIAlertAction *action))confirmHandler withCancelAction:(void (^ __nullable)(UIAlertAction *action))cancelHandler{
    
    UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"温馨提示"
                                                                   message:msg
                                                            preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault
                                                          handler:confirmHandler];
    UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel
                                                         handler:cancelHandler];
    
    [alert addAction:defaultAction];
    [alert addAction:cancelAction];
    [self presentViewController:alert animated:YES completion:nil];
    
}

- (NSString *)getTitleWithStyle:(NSInteger )style{
    NSString * stateStr = @"";
    //订单状态 0-待付款 10-待发货 20-待收货 30-待评价 40-已完成 50-退款中 51-退款被拒绝 60 -退款成功 90-已取消
    switch (style) {
        case 0:
            stateStr = @"待付款";
            
            break;
        case 10:
            stateStr = @"待发货";
            
            break;
        case 11:
            if (self.type == IdentifyAndMaintainDetailType_Identify) {
                 stateStr = @"待鉴定";
            }else if (self.type == IdentifyAndMaintainDetailType_Maintain){
                stateStr = @"待养护";
            }
            break;
            
        case 20:
            stateStr = @"待收货";
            
            break;
        case 30:
            stateStr = @"待评价";
            
            break;
        case 40:
            stateStr = @"已完成";
            
            break;
        case 50:
            stateStr = @"退款中";
            
            break;
        case 51:
            stateStr = @"退款被拒绝";
            
            break;
        case 60:
            stateStr = @"退款成功";
            
            break;
        case 90:
            stateStr = @"取消";
            
            break;
        default:
            break;
    }
    return stateStr;
}


- (void)requestOrderDetail{
    NSDictionary * params = @{@"order_id":self.orderId,@"token":UserInfo.userToken};
    WEAKSELF
    [[MainApi sharedInstance] postPath:@"Otherorder/detail" params:params resultBlock:^(NSDictionary *responseObject, NSError *error) {
        STRONGSELF
        NSLog(@"%@===",responseObject);
        if (responseObject && !error) {
            strongSelf.detailModel = [[IdOrMteDetailModel alloc]initWithDictionary:responseObject error:nil];
            
        }
       [self setNavigationItemTitle: [strongSelf getTitleWithStyle:[strongSelf.detailModel.data.status integerValue]]];
        [strongSelf.tableView reloadData];
    }];
}


- (void)registerCell{
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderAddressCell class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailAddressCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderDetailNotifierCell class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailNotifierCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderGoodsImgCell  class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailGoodsImgCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderGoodsInfoCell class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailGoodsInfoCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderGoodsServiceCell  class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailGoodsServiceCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderInfoCell  class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailInfoCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([OrderNewAddressCell  class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailNewAddressCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([IdentifyResultsCell  class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailIdentifyResultsCellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([GoodsSectionCell   class]) bundle:nil] forCellReuseIdentifier:IdentifyAndMaintainDetailGoodsSectionCellIdentifier];
    
}

- (CGRect)getTableViewFrame{
    
    CGFloat bottomHeight = 0;
    if (self.state == IdentifyAndMaintainDetailState_waitComment||self.state == IdentifyAndMaintainDetailState_waitPayment|| self.state == IdentifyAndMaintainDetailState_waitGoods||self.state == IdentifyAndMaintainDetailState_waitSend){
        bottomHeight = 50;
    }
    CGRect tableFrame = CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height -bottomHeight);
    return tableFrame;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    NSInteger section =  0;
    if (self.detailModel) {
        section = 6;
    }
    return section;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSInteger row = 0;
    switch (section) {
        case 0:{
            if(self.state == IdentifyAndMaintainDetailState_waitGoods ||self.state == IdentifyAndMaintainDetailState_waitComment ||self.state == IdentifyAndMaintainDetailState_refundReview ||self.state == IdentifyAndMaintainDetailState_completeRefund || self.state == IdentifyAndMaintainDetailState_waitIdOrMt){
                row = 1;
                
            }else{
                row = 0;
            }
        }
            break;
        case 1:
            if (self.type == IdentifyAndMaintainDetailType_Identify &&( self.state == IdentifyAndMaintainDetailState_waitComment  ||self.state == IdentifyAndMaintainDetailState_waitGoods ||self.state ==IdentifyAndMaintainDetailState_complete)){
                row = 1;
            }else{
                row = 0;
            }
            
            break;
        case 2:
            row = [self.detailModel.data.goods_item count]+1;
            break;
        case 3:
            row = 1;
            break;
        case 4:
            row = 1;
            break;
        case 5:
            row =    6;
            break;
            
        default:
            break;
    }
    
    return row;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = nil;
    if (indexPath.section == 0) {
        OrderDetailNotifierCell * tempCell = [tableView dequeueReusableCellWithIdentifier: IdentifyAndMaintainDetailNotifierCellIdentifier];
        DetailNotifierStyle style =  DetailNotifierStyle_noraml;
        NSString * logisticsName = @"";
        NSString * logisticsNo = @"";
        if (self.state == IdentifyAndMaintainDetailState_waitGoods|| self.state == IdentifyAndMaintainDetailState_waitComment || self.state == IdentifyAndMaintainDetailState_waitIdOrMt) {
            style = DetailNotifierStyle_logistics;
            logisticsName = self.detailModel.data.express_name;
            logisticsNo = self.detailModel.data.express_no;
        }else if (self.state == IdentifyAndMaintainDetailState_refundReview){
            style = DetailNotifierStyle_refundAudit;
        }else if(self.state == IdentifyAndMaintainDetailState_completeRefund){
            style = DetailNotifierStyle_refund;
        }
        [tempCell  setupOrderDetail:style withLogisticsName:logisticsName withLogisticsNo:logisticsNo];
        tempCell.btnBlock = ^(DetailNotifierStyle style) {
            if (style == DetailNotifierStyle_logistics) {
                //物流
                [self gotoLogisticsVC];
            }else if (style == DetailNotifierStyle_refundAudit){
                //退款审核
                [self gotoRefundAuditVC];
            }else if (style == DetailNotifierStyle_refund){
                //退款成功
                [self gotoRefundCompleteVC];
            }
        };
        cell = tempCell;
    }else if (indexPath.section == 1){
        IdentifyResultsCell * tempCell = [tableView dequeueReusableCellWithIdentifier: IdentifyAndMaintainDetailIdentifyResultsCellIdentifier];
        tempCell.btnBlock = ^(IdentifyResultsType type) {
            if (type ==  IdentifyResultsType_jimai) {
                [self gotoJiShuMaiVC];
            }else if (type == IdentifyResultsType_huishou){
                
                [self gotoJiShuHuiShouVC];
            }
        };
        cell = tempCell;
        
    }else if (indexPath.section == 2){
        if (indexPath.row == 0) {
            GoodsSectionCell * tempCell = [tableView dequeueReusableCellWithIdentifier:IdentifyAndMaintainDetailGoodsSectionCellIdentifier];
            NSString * titleStr = @"";
            if (self.type == IdentifyAndMaintainDetailType_Identify) {
                titleStr = @"鉴定商品";
            }else if (self.type == IdentifyAndMaintainDetailType_Maintain){
                titleStr = @"养护商品";
            }
            [tempCell setupTitle:titleStr];
            cell = tempCell;
        }else{
            OrderGoodsImgCell * tempCell = [tableView dequeueReusableCellWithIdentifier:IdentifyAndMaintainDetailGoodsImgCellIdentifier];
            [tempCell setupADdressData:self.detailModel.data.goods_item[indexPath.row -1]];
            cell = tempCell;
            
        }
        
    }else if (indexPath.section == 3){
      
        
        OrderAddressCell * tempCell = [tableView dequeueReusableCellWithIdentifier: IdentifyAndMaintainDetailAddressCellIdentifier];
        [tempCell setupSendAddressInfo:self.detailModel.data withTitle:@"寄件地址"];
        cell = tempCell;
    }else if (indexPath.section == 4){
        
        OrderAddressCell * tempCell = [tableView dequeueReusableCellWithIdentifier: IdentifyAndMaintainDetailAddressCellIdentifier];
        [tempCell setupBackAddressInfo:self.detailModel.data withTitle:@"回寄地址"];
        cell = tempCell;
    }else if (indexPath.section == 5){
      if (indexPath.row >= 0 &&indexPath.row<  4){
            
            OrderGoodsInfoCell * tempCell = [tableView dequeueReusableCellWithIdentifier:IdentifyAndMaintainDetailGoodsInfoCellIdentifier];
            NSString * titleStr = @"";
            NSString * price = @"";
            if (indexPath.row == 0) {
 
              
                if (self.type == IdentifyAndMaintainDetailType_Identify) {
                    titleStr = @"鉴定费";
                }else if (self.type == IdentifyAndMaintainDetailType_Maintain){
                    titleStr = @"养护费";
                }
                price =  [@"￥" stringByAppendingString:self.detailModel.data.all_total_price];
            }else if (indexPath.row ==1){
                titleStr = @"红包抵扣";
                price =  [@"-￥" stringByAppendingString:self.detailModel.data.redpack_discount];
            }else if (indexPath.row == 2){
                titleStr = @"优惠券抵扣";
                price =  [@"-￥" stringByAppendingString:self.detailModel.data.coupon_discount];
            }
            else if (indexPath.row == 3){
                titleStr = @"应付";
                price =  [@"￥" stringByAppendingString:self.detailModel.data.pay_price];
            }
            [tempCell setupTitle:titleStr withPrice:price];
            cell = tempCell;
        }else if (indexPath.row ==  4){
            OrderGoodsServiceCell * tempCell = [tableView dequeueReusableCellWithIdentifier:IdentifyAndMaintainDetailGoodsServiceCellIdentifier];
            tempCell.serviceBlock = ^{
                //联系客服
                [self gotoServiceVC];
            };
            cell = tempCell;
        }else if (indexPath.row ==  5){
            
            OrderInfoCell * tempCell =[tableView dequeueReusableCellWithIdentifier:IdentifyAndMaintainDetailInfoCellIdentifier];
            [tempCell setupADdressData:self.detailModel.data withState:self.navigationItem.title];
            cell = tempCell;
        }
        
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat height = 0;
    if (indexPath.section == 0) {
        height = 114;
    }else if (indexPath.section == 1){
        height = 160;
        
    }else if (indexPath.section == 2){
        if (indexPath.row == 0) {
            height = 30;
        }else{
            height = 95;
            
        }
        
    }else if (indexPath.section == 3){
        height = 100;
        
    }else if (indexPath.section == 4){
        height = 100;
        
    }else if (indexPath.section == 5){
        
        if (indexPath.row >=0 &&indexPath.row<   4){
            height = 40;
        }else if (indexPath.row ==     4){
            height = 76;
        }else if (indexPath.row ==   5){
            height = 80;
        }
        
        
    }
    
    return height;
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    CGFloat height = 0.001;
    if (section>=1) {
        height = 10;
    }
    return height;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section == 0) {
        if (self.state == IdentifyAndMaintainDetailState_waitGoods|| self.state == IdentifyAndMaintainDetailState_waitComment) {
            //物流
            [self gotoLogisticsVC];
        }else if (self.state == IdentifyAndMaintainDetailState_refundReview){
            //退款审核
            [self gotoRefundAuditVC];
        }else if (self.state == IdentifyAndMaintainDetailState_completeRefund){
            //退款成功
            [self gotoRefundCompleteVC];
        }
        
    }
}


- (void)gotoCommentVC{
    
    LGCommentViewController * commentVC = [[LGCommentViewController alloc]initWithOrderId:self.orderId withVCType:LGCommentVCType_idOrMatn];
    if (self.fromVCType == IdentifyAndMaintainFromVCType_Msg) {
        commentVC.fromVCType = CommentFromVCType_Msg;
    }
    
    [self pushViewController:commentVC];
}
//申请退款
- (void)gotoRefundApplyVC{
    LGRefundApplyVC * refundApplyVC = [[LGRefundApplyVC alloc]initWithInfoModel:self.detailModel.data];
    if (self.fromVCType == IdentifyAndMaintainFromVCType_Msg) {
        refundApplyVC.fromVCType = RefundApplyFromVCType_Msg;
    }
    [self pushViewController:refundApplyVC];
}
//申请退款 退款详情
- (void)gotoRefundAuditVC{
    
    [self refundDetailStyle:RefoundDetailVCStyle_apply];
}
//退款成功 退款详情
- (void)gotoRefundCompleteVC{
    [self refundDetailStyle:RefoundDetailVCStyle_complete];
}
- (void)refundDetailStyle:(RefoundDetailVCStyle )style{
    
    RefoundDetailViewController * detailVC = [[RefoundDetailViewController alloc]initWithOrderId:self.orderId withStyle:style withType:RefoundDetailVCType_idOrMatn];
    if (self.fromVCType == IdentifyAndMaintainFromVCType_Msg) {
        detailVC.fromVCType = RefoundDetailFromVCType_Msg;
    }
    [self pushViewController:detailVC];
}

- (void)gotoLogisticsVC{
    OrderLogisticsViewController * logisticsVC = [[OrderLogisticsViewController alloc]initOrderId:self.orderId withVCType:LogisticsVCType_idOrMatn];
    [self pushViewController:logisticsVC];
    
}

-  (void)gotoAddExpressVC{
    AddSendInfoViewController * sendInfoVC = [[AddSendInfoViewController alloc]initWithOrderId:self.orderId withType:AddSendInfoVCType_idOrMatn];
    if (self.fromVCType == IdentifyAndMaintainFromVCType_Msg) {
        sendInfoVC.fromVCType = AddSendInfoFromVCType_Msg;
    }
    [self pushViewController:sendInfoVC];
    
}
#pragma mark ----
//极速卖
- (void)gotoJiShuMaiVC{
    
    
}
//极速回收
- (void)gotoJiShuHuiShouVC{
    
}

//客服
- (void)gotoServiceVC{
    CustomerServiceViewController * tempVC = [[CustomerServiceViewController alloc]init];
    [self pushViewController:tempVC];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
